import svgIcon from './components/SvgIcon/index';
import tablebox from './components/TableBox/index';
import plxTableBox from './components/PlxTableBox/index';
import orgTree from './components/OrgTree/index';
import searchForm from './components/SearchForm/index';
import inputWithDialog from './components/InputWithDialog/index';
import importFiles from './components/ImportFiles/index';
import importTask from './components/ImportFiles/importTask/index';
import exportFiles from './components/ExportFiles/index';
import qrEncode from './components/QREncode/index';
import wangEditor from './components/wangEditor/index';
import tinyEditor from './components/tinyEditor';
import {List,ListItem} from './components/List';
import DictCheckbox from './components/DictCheckbox';
import DictSelectPicker from './components/DictSelectPicker';
import FormContainer from './components/FormContainer';
import SearchSelectPicker from './components/SearchSelectPicker';
import TableSearchBar from './components/TableBox/components/table-search'
import QupIcon from "./components/QupIcon/index.vue";

const components = [
  tablebox,
  plxTableBox,
  svgIcon,
  orgTree,
  searchForm,
  inputWithDialog,
  importFiles,
  importTask,
  exportFiles,
  qrEncode,

  List,
  ListItem,
  DictCheckbox,
  DictSelectPicker,
  FormContainer,
  SearchSelectPicker,
  TableSearchBar,

  wangEditor,
  tinyEditor,
  QupIcon
]


const install = function (Vue, opts = {}) {
  components.map(component => {
    Vue.component(component.name, component);
  })
}

/* import Cookies from 'js-cookie'
if (!Cookies.get('Admin-Token')) {
  if (self === top && location.href.indexOf('localhost:') === -1 && location.href.indexOf('/login') === -1) {
    location.href = '/login'
  }
} */


/* 支持使用标签的方式引入 */
if (typeof window !== 'undefined' && window.Vue) {
  install(window.Vue);
}


export default {
  install,
  tablebox,
  plxTableBox,
  svgIcon,
  orgTree,
  searchForm,
  inputWithDialog,
  importFiles,
  importTask,
  exportFiles,
  qrEncode,

  List,
  ListItem,
  DictCheckbox,
  DictSelectPicker,
  FormContainer,
  SearchSelectPicker,
  TableSearchBar,
  QupIcon
}
